import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/colors/my_colors.dart';
import 'package:flutter_app/screen_page.dart' as prefix0;

//不是固定标题和返回Icon
Widget BasePage(Widget _top, Widget _bottom) {
  return AnnotatedRegion<SystemUiOverlayStyle>(
    value: SystemUiOverlayStyle.dark,
    child: Scaffold(
      appBar: PreferredSize(
          child: Container(
            width: double.infinity,
            height: double.infinity,
            decoration: BoxDecoration(
              color: Colors.white,
              //   gradient: LinearGradient(colors: [Colors.yellow, Colors.pink])
            ),
            child: SafeArea(child: _top),
          ),
          preferredSize: Size(double.infinity, 40)),
      body: _bottom,
    ),
  );
}

Widget BaseTitlePage(BuildContext context, String title, Widget _bottom) {
  return AnnotatedRegion<SystemUiOverlayStyle>(
    value: SystemUiOverlayStyle.dark,
    child: Scaffold(
      appBar: PreferredSize(
          child: Container(
            width: double.infinity,
            height: double.infinity,
            decoration: BoxDecoration(
              color: Colors.white,
              //   gradient: LinearGradient(colors: [Colors.yellow, Colors.pink])
            ),
            child: SafeArea(
                child: Container(
              width: prefix0.width(375),
              child: Column(
                children: <Widget>[
                  Container(
                    child: Row(
                      children: <Widget>[
                        Container(
                          height: prefix0.height(40),
                          width: prefix0.width(40),
                          child: Material(
                            color: Colors.transparent,
                            borderRadius:
                                BorderRadius.circular(prefix0.height(20)),
                            child: InkWell(
                              onTap: () {
                                Navigator.of(context).pop();
                              },
                              child: Image.asset("images/back_icon.png",
                                  width: prefix0.width(40),
                                  height: prefix0.height(40)),
                            ),
                          ),
                        ),
                        Container(
                          width: prefix0.width(295),
                          child: Center(
                            child: Text(title,
                                style: TextStyle(
                                    fontSize: prefix0.sp(17),
                                    color: MyColors.font_black)),
                          ),
                        )
                      ],
                    ),
                  ),
                  Container(
                    width: prefix0.width(375),
                    height: prefix0.height(1),
                    color: MyColors.back_bright_gray,
                  )
                ],
              ),
            )),
          ),
          preferredSize: Size(double.infinity, prefix0.height(41))),
      body: _bottom,
    ),
  );
}

//分割线
Widget LinePage({double height = 1}) {
  return Container(
    width: prefix0.width(375),
    height: prefix0.height(height),
    color: MyColors.back_bright_gray,
  );
}
